Determining
a Decompressor s Output Format
The following
example determines the buffer size needed for the data specifying the
decompression format using the ICDecompressGetFormatSizeF12W9. function, and retrieves the decompression
format information using the ICDecompressGetFormat macro.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// Assume *lpbiIn points to the input (compressed)
format.
dwFormatSize = ICDecompressGetFormatSize(hIC,
lpbiIn);
h = GlobalAlloc(GHND, dwFormatSize);
lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h);
ICDecompressGetFormat(hIC, lpbiIn, lpbiOut);
The following
example shows how an application can use the ICDecompressQuery
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// Assume *lpbiIn & *lpbiOut are initialized to
the respective
// formats.
if (ICDecompressQuery(hIC, lpbiIn, lpbiOut) ==
ICERR_OK)
{
// Format
is supported - use the decompressor.
}
The following
code fragment shows how to get the palette information using the ICDecompressGetPalette
ICDecompressGetPalette(hIC, lpbiIn, lpbiOut);
// Move up to the palette.
lpPalette = (LPBYTE)lpbiOut + lpbi->biSize;